<template>
  <div class="gateSetting">
    <TitleSubColumn name="开闸设置" />
    <div class="content">
      <div class="parameters">
        <section>
          <p>预设开度：</p>
          <a-input-number
            class="inputNumber"
            v-model:value="state.openSize"
            :min="0"
            :max="1"
            :precision="2"
          />
        </section>
        <!-- <section>
          <p>控制密度：</p>
          <a-input-number
            class="inputNumber"
            v-model:value="state.density"
            :min="1"
            :max="200"
          />
        </section> -->
      </div>
      <div class="liveVideo">
        <img src="./liveVideo.png" alt="" />
      </div>
      <div class="operationBtn">
        <div class="btn1" @click="handleUpdateGate">执行开度</div>
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
  import { reactive } from "vue";
  import TitleSubColumn from "@/components/TitleSubColumn";
  import { updateGate } from '@/api/oneMap/baseData';

  defineOptions({ name: "GateSetting" });

  const state = reactive({
    openSize: "",
    density: "",
  });

  const props = defineProps({
    selectValue: { type: String },
  });

  const handleUpdateGate = async() => {
    const paramData = {
      stcd: props.selectValue,
      openSize: state.openSize,
    }
    await updateGate(paramData);
  }
</script>

<style lang="less" rel="stylesheet/less" scoped>
.gateSetting {
  width: calc(50% - 16px);
  height: 100%;
  border: 1px solid;
  border-image: linear-gradient(
    180deg,
    rgba(99, 223, 255, 0) 0%,
    rgba(99, 223, 255, 0.5) 100%
  );
  border-image-slice: 1;
  padding: 10px;
  .parameters {
    display: flex;
    padding-top: 10px;
    margin-bottom: 10px;
    align-items: center;
    justify-content: center;
    section {
      display: flex;
      align-items: center;
      p {
        font-size: 12px;
        color: #b4dfff;
        padding-left: 10px;
      }
      .inputNumber {
        width: 120px !important;
        height: 24px;
        background: #003e7e6b;
        border: 1px solid;
        border-image: linear-gradient(
          181deg,
          rgba(6, 183, 253, 0.4) 3.03%,
          #51fbff 47.23%,
          rgba(6, 183, 253, 0.4) 91.41%
        );
        border-image-slice: 1;
        color: #fff;
        font-size: 14px;
        border-radius: 6px;
      }
    }
  }
  .liveVideo {
    width: 276px;
    height: 240px;
    position: relative;
    &::after {
      content: '';
      display: inline-block;
      width: 100%;
      height: 100%;
      background: url(./liveVideoBG.png) no-repeat;
      background-size: 100% 100%;
      position: absolute;
      left: 0;
      top: 0;
      pointer-events: none;
    }
    img {
      width: 100%;
      height: 100%;
    }
  }
  .operationBtn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
    .btn1 {
      width: 160px;
      height: 32px;
      /* background: url(./btn1.png) no-repeat;
      background-size: contain; */
      cursor: pointer;
      background: linear-gradient(180deg, rgba(0, 40, 81, 0.6) -10.87%, rgba(2, 110, 194, 0.6) 80.43%);
      box-shadow: 0px 0px 9.23px 0px #06B7FD inset;
      box-shadow: 0px 4.62px 6.92px 0px #06B7FD85;
      backdrop-filter: blur(4px);
      border: 1px solid;
      border-image: linear-gradient(90deg, rgba(220, 237, 255, 0.32) 0%, #DCEDFF 45.95%, rgba(220, 237, 255, 0.32) 95.89%);
      border-image-slice: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #fff;
      font-size: 15px;
      font-style: italic;
      letter-spacing: 4px;
      font-weight: bold;
      &:hover {
        opacity: 0.8;
      }
    }
    .btn2 {
      width: 160px;
      height: 46px;
      background: url(./btn2.png) no-repeat;
      background-size: contain;
      cursor: pointer;
      &:hover {
        opacity: 0.8;
      }
    }
  }
}
</style>
